<script type="text/javascript">
    var form_validation=true;
    function submit_cgsnapshot_update(isforce){
        var cgsnapshot_name = $("#div_cgsnapshot_create_update").find("#cgsnapshot_name_cr");
     	var bValid = true;
//        bValid = cgsnapshot_scale(capacity.val(),false);
        bValid = bValid && checkLength(cgsnapshot_name, "名称", 1, 32 );
        if (bValid) {
            $(".table .error_tip").hide();
            if (isforce){form_validation = true}
          if(form_validation){
             $(".callback_error_tip").text("正在提交中......").css({"display":"block","color":'#000'});        
            form_validation=false;
            $.post("/cgsnapshot_update",{
                        "name" : cgsnapshot_name.val(),    
                        "id":"{{ cgsnapshot.id }}"
                        },
                    function(data){
                        if (data.reply.is_success){
                            //$("#div_cgsnapshot_create_update").dialog("close");
                            $('#cgsnapshot_table').trigger("reloadGrid");
                            cgsnapshots_show("{{ cgsnapshot.volume_id }}")
                        }else{
                            error =  data.reply.error;
                            $(".callback_error_tip").css("display","block");
                            $(".callback_error_tip").text(error);
                            form_validation=true;                           
                        }
                 });
           }
          else
          {
             $(".callback_error_tip").text("正在提交中......").css({"display":"block","color":'#000'});        
           }
        }
    }
</script>
<style>
.table .tb-item-value > div:first-child{margin-bottom:5px;color:#666}
</style>
<div id="dialog_cgsnapshot_update" title="创建快照">  
    <!--<div class="error_tip"></div>-->
    <form id="cgsnapshot_add_form">
    <p>&nbsp;带<a class="high_tip_red">*</a>号的必填项</p>
    <div class="callback_error_tip error_tip"></div>            
    <div class="error_tip"></div>
    <table class="table">
        <tr class="tr-back">
            <td class="tb-item-name"><label for="cgsnapshot_name_cr">组快照名称:</label><a>*</a></td>
            <td class="tb-item-value">
         	 	<div>(由1到32位以下大小写英文字母、数字、中划线(英文)或下划线构成）</div> 
         	 	<div class="error_tip"></div>
          		<input id="cgsnapshot_name_cr" name="cgsnapshot_name_cr" size="25" type="text" value="{{ cgsnapshot.name |default('', True) }}"/>
            </td>             
        </tr>
    </table>
    </table>
    </form>
</div>
<div id='warn_size_confirm' >
</div>
